'
游戏主场景
'

extends Node

@export var end_screen_scene: PackedScene
@export var pause_screen_scene: PackedScene

func _ready() -> void:
	%Player.died.connect(on_player_died)
	pass

#处理未被处理的信号
func _unhandled_input(event: InputEvent) -> void:
	if event.is_action_pressed("pause"):
		self.get_tree().root.set_input_as_handled()
		self.add_child(pause_screen_scene.instantiate())
	#elif event.is_action_pressed("backpack"):#背包功能
		#pass
	#elif event.is_action_pressed("map"):#地图功能
		#pass
	pass

#玩家死亡，游戏结束
func on_player_died() -> void:
	var end_screen_instance = end_screen_scene.instantiate()
	self.add_child(end_screen_instance)
	end_screen_instance.set_ending(false)
	pass
